package com.badibadi.adapter;

import java.util.List;

import com.badibadi.activity.MyDataActivity;
import com.badibadi.mytools.SelectPicLayoutActivity;
import com.badibadi.uniclubber.R;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.sax.StartElementListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class SendDynamicUpPictureAdapter extends BaseAdapter{


	private Context context;
	/*
	 * 保存路径名称
	 */
	private List<String> list;

	public SendDynamicUpPictureAdapter(Context context)
	{
		this.context=context;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size()+1;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LayoutInflater inflater=LayoutInflater.from(context);
		
		if(position==list.size()+1)
		{
			convertView=inflater.inflate(R.layout.aah, null);
			convertView.findViewById(R.id.aah).setOnClickListener(new View.OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					Intent intent = new Intent(context,
							SelectPicLayoutActivity.class);
					((Activity)(context)).startActivityForResult(intent, position);
				}
			});
			return convertView;
		}
		else
		{
			convertView=inflater.inflate(R.layout.aah, null);
			ImageView iv=(ImageView)convertView.findViewById(R.id.aah);
			iv.setImageURI(Uri.parse(list.get(position)));
		}
		
		
		return convertView;
	}

	public void setOnItemViewClistener(setItemView v)
	{
		
	}
	
	
	public interface setItemView
	{
		void setItemView(int position);
	}
}
